package com.nhncorp.mojo.jumble;

import java.util.Iterator;
import java.util.Set;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

/**
 * 
 * @author NHN Corporation
 * @version $Rev$, $Date$
 * @goal dependency
 * @inheritByDefault false
 * @requiresProject
 */
public class JumbleDependencyMojo extends AbstractMutationMojo {
	public void execute() throws MojoExecutionException, MojoFailureException {
		boolean executed = false;

		String fileSeparator = System.getProperty("file.separator");
		String pathSeparator = System.getProperty("path.separator");
		String userDir = System.getProperty("user.dir");
		StringBuffer classesDir = new StringBuffer(fileSeparator).append("target").append(fileSeparator).append("classes");
		StringBuffer testClassesDir = new StringBuffer(fileSeparator).append("target").append(fileSeparator).append("test-classes");
		Set dependencies = getDependencies();
		Iterator<Artifact> iterator = dependencies.iterator();
		StringBuffer sb = new StringBuffer();

		while (iterator.hasNext()) {
			Artifact key = iterator.next();
			sb.append(key.getFile().getAbsolutePath()).append(pathSeparator);
		}

		sb.append(userDir).append(classesDir);
		sb.append(pathSeparator).append(userDir).append(testClassesDir);
		
		getLog().info("Maven dependency path: " + sb.toString());

		if (!executed) {
			getLog().info("Mutation Test is finished.");
		}
	}
}
